import { Steps } from 'antd';
import { useState } from 'react';
import AddGroupBuyInfo from '../../../componets/AddGroupBuyInfo';
import AddGroupBuyFinish from '../../../componets/AddGoupBuyFinish';
import AddGroupBuyProduct from '../../../componets/AddGroupBuyProduct';

function CreateGroupBuy() {
  const [current, setCurrent] = useState(0);
  
  var baseInfo = {"name":"","startTime":"","endTime":"","slogan":"","showHome":"","homePic":null,"banner":null,"showType":"1","target":"1","limitBuy":999,"shop":"537,538,539","deliverWay":"1","pickTime":"","products":"","preTime":"","tag":"","state":"0"}
  const [groupInfo,setGroupInfo] = useState(baseInfo)
  const  items=[
    {
      title: '活动信息',  
      content:<AddGroupBuyInfo setCurrent={setCurrent } groupInfo={groupInfo} setGroupInfo={setGroupInfo}/>
    },
    {
      title: '添加商品',
      content:<AddGroupBuyProduct setCurrent={setCurrent }  groupInfo={groupInfo} setGroupInfo={setGroupInfo} />
    },
    {
      title: '创建成功',
      content:<AddGroupBuyFinish/>
    },
  ]
  const onChange = (value: number) => {
    setCurrent(value);
  };
  return ( <div style={{height:"100%",display:"flex",flexDirection:'column'}}>
    <h3>创建团购活动</h3>
    <Steps

        style={{width:'50%',margin:'0 auto'}}
        current={current}
        onChange={onChange}
        labelPlacement="vertical"        
        items={items}
      />
      <div style={{backgroundColor:"#fff",flex:"1",padding:16,}}>
          {items[current].content}
      </div>
     
  </div> );
}

export default CreateGroupBuy;